package service

import (
	"gligli/model"
	"gligli/serializer"
)

// ShowVideoService 视频投稿的服务
type ShowVideoService struct {
}

// Show 创建视频
func (service *ShowVideoService) Show(id string) serializer.Response {
	var video model.Video
	err := model.DB.First(&video, id).Error
	//报错
	if err != nil {
		return serializer.Response{
			Status: 404,
			Msg:	"视频获取失败",
			Error: err.Error(),
		}
	}
	// 增加点击数
	video.AddView()

	return serializer.Response{
		Data: serializer.BuildVideo(video),

	}
}
